<template>
    <div>
        <h2>应声信息列表显示</h2>
        <table class="table table-bordered table-striped">
            <tbody>
                <tr>
                    <td>姓名</td>
                    <td>头像</td>
                    <td>科室</td>
                    <td>入职时间</td>
                </tr>
                <tr v-for="item in pdate.list">
                    <td>{{ item.tname }}</td>
                    <td><img :src="item.img" style="width: 60px; height: 60px;"></td>
                    <td>{{ item.userName }}</td>
                    <td>{{ item.createDate.substring(0, 10) }}</td>
                </tr>
            </tbody>
        </table>
    </div>
    当前页：{{ pages.pageIndex }} 总页数：{{ pdate.totalPage }} 总条数：{{ pdate.totalCount }}
     <input type="button" value="首页" @click="pages.pageIndex=1,ShowUser()"> 
     <input type="button" value="上一页" @click="pages.pageIndex--,ShowUser()"> 
     <input type="button" value="下一页" @click="pages.pageIndex++,ShowUser()">
    <input type="button" value="尾页" @click="pages.pageIndex=pdate.totalPage,ShowUser()">
</template>

<script setup lang="ts">


import axios from 'axios';
import { ref, reactive, onMounted } from 'vue';
import { ElMessage } from 'element-plus';


let pdate = reactive({
    list: [],
    totalPage: 0,
    totalCount: 0
})

///宋有奇测试更新 码云 git
let pages = reactive({
    pageIndex: 1,
    pageSize: 2
})

onMounted(() => {
    ShowUser();
})

const ShowUser = () => {
    axios({
        url: '/api/Hotel/ShowUser',
        method: 'get',
        params: pages
    }).then((res) => {
        Object.assign(pdate, res.data);
        console.log(pdate);

    })
}

</script>

<style scoped></style>